/*
 * Drawable.java
 *
 * Created on 9 maj 2007, 18:56
 *
 */

package pl.krakow.ae.knp.wikiboard.gui.drawables;

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;

/**
 * An interface that represents any object which can be drawn on the board.
 */
public interface Drawable 
{
    // A distance between a Drawable and a selection outline
    short SELECT_PADDING = 10;
    
    // Width of a selection stroke
    short STROKE_WIDTH = 3;
    
    /**
     * A method that draws the Drawable.
     * @param g a graphics context to draw to.
     * @param dragged indicates whether the object is being dragged.
     */
    void draw(Graphics2D g, boolean dragged);
    
    /** 
     * A method that moves the Drawable towards given coordinates.
     * @param x x movement coordinate.
     * @param y y movement coordinate.
     */
    
    void move(double x, double y);
    
    /** A method that rotates the Drawable */ 
    void rotate();
    
    /** 
     * A method that drags the Drawable towards given point during first drawing.
     * @param p a point where the user drags while resizing.
     */
    void drag(MouseEvent event);
    
    /**
     * A method that returns true when the Drawable contains the given point.
     * @param p a point.
     * @return true when the Drawable contains the given point.
     */
    boolean contains(Point2D p);
    
    /**
    * A method that returns a deep copy of the object.
    * @return a deep copy of the object.
    */
    Drawable clone();
    
    /** Called by Tool whenever object is selected. */
    void select();
    
    /** Called by Tool whenever object is unselected. */
    void unselect();
}
